#ifndef SETTINGPARSER_H
#define SETTINGPARSER_H

#include <QObject>
#include <QFile>
#include <QMap>
#include "AbstractLayer/Encipher/encipher.h"
#include <QJsonObject>
#include <QJsonDocument>
#include <QMap>



class SettingParser : public QObject
{

    Q_OBJECT
public:
    static SettingParser* getInstance();
    void initParser(const QString& path);
    void analysisFile();
    QString getValue(const QString& key);
    void setValue(const QString& key,const QString& value);
    void flushBuf();
    bool isFirst();
    QByteArray makeSettings();
    QMap<QString,QString> getMap();
signals:
    void s_loadDone();

    void s_newmessagering(bool);
    void s_voicecallring(bool);
    void s_videocallring(bool);
    void s_enter(bool);
    void s_ring(int);
private slots:

private:
    SettingParser();
    QByteArray newSettings();
    static SettingParser* parser;
    QString filepath;
    QByteArray arr;
    QMap<QString,QString> settingmap;
    //QHash<QString,int> keyhash;
    //QHash<QString,int> valuehash;
    QMap<QString,std::function<void(bool)>> changefuncmap;
    bool changed;
};

#endif // SETTINGPARSER_H
